package com.game;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;


public abstract class EditTableActivity extends Activity implements OnClickListener {

	protected DBAdapter myDBAdapter;
	protected Button SubmitButton;
	protected Button ViewButton;
	protected Button HomeButton;
	protected Button EditButton;
	protected Class<?> ViewClass;


	protected abstract void initalize();
	protected abstract void edit();

	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		initalize();
		myDBAdapter = ((txtGameApplication)this.getApplication()).getDatabaseAdapter();

	}

	public void onClick(View v) {

		if (v== SubmitButton) {
			save();
		} else if (v == ViewButton) {
			view();
		} else if (v == HomeButton) {
			home();
		} else if (v== EditButton) {
			edit();
		}

	}

	protected abstract void save();

	protected void view() {
		startActivity(new Intent(this, ViewClass));
	}

	private void home() {
		startActivity(new Intent(this, StartScreen.class));
	}



}
